package cn.demo.reverseProxy.filter;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @Author: ljh
 * @Date: 2019/10/9 21:29
 * zuul路由过滤器
 * 应用举例：根据条件将请求转发到新老服务
 */
@Component
public class SpecialRoutesFilter extends ZuulFilter {

    private static final boolean SHOULD_FILTER = true;
    private static final Logger log = LoggerFactory.getLogger(SpecialRoutesFilter.class);

    @Override
    public String filterType() {
        return "route";
    }

    @Override
    public int filterOrder() {
        return 1;
    }

    @Override
    public boolean shouldFilter() {
        return SHOULD_FILTER;
    }

    @Override
    public Object run() {
        return null;
    }
}
